home *** CD-ROM | disk | FTP | other *** search
/ Nebula 1 / Nebula One.iso / Utilities / Other / mCD / Source / scsi_cd.subproj / cd_commands.h < prev    next >
Encoding:
C/C++ Source or Header  |  1995-03-11  |  5.5 KB  |  167 lines

  1. /*
  2.  * cd_commands.h: header file for cd_commands.c
  3.  *
  4.  * This is based on the file that NeXT included in
  5.  *      /NextDeveloper/Examples/UNIX/SCSI_CD,
  6.  *      done by James C. Lee at NeXT, Sep 1991.
  7.  * It has been changed "just a bit" by Garance Alistair Drosehn/March 1994.
  8.  *
  9.  */
  10.  
  11. #ifndef CD_COMMANDS
  12. #define CD_COMMANDS
  13.  
  14. #import <sys/types.h>
  15. #import <libc.h>
  16. #import <sys/time.h>
  17. #import "cd_toc.h"        /* declares struct cd_toc */
  18.  
  19. /* I use a copy of the NS-3.1 version of bsd/dev/scsireg.h, because
  20.  * at some point I think I want to split it apart into "field values"
  21.  * (such as #define DEVTYPE_DISK), and actual structure definitions.
  22.  *                  Garance Drosehn/Mar 94
  23.  */
  24. /* #import <bsd/dev/scsireg.h> */
  25. #import "scsireg_31.h"        /* garance... */
  26.  
  27. int
  28. do_eject_1b(int fd, struct timeval * tvp, struct esense_reply * erp);
  29. int
  30. do_spinup_1b(int fd, struct timeval * tvp, struct esense_reply * erp);
  31. int
  32. do_stopunit_1b(int fd, struct timeval * tvp, struct esense_reply * erp);
  33. int
  34. do_pauseaudio_4b(int fd, int pause, struct esense_reply * erp);
  35. int
  36. do_pauseaudio_c5(int fd, int pause, struct esense_reply * erp);
  37. int
  38. do_preventremoval_1e(int fd, int prevent, struct esense_reply * erp);
  39. int
  40. do_rezerounit_01(int fd, struct esense_reply * erp);
  41. int
  42. do_readtoc_43(int fd, struct cd_toc * toc_all, struct esense_reply * erp);
  43.  
  44. int
  45. do_playaudio_c8(int fd, int lba, int length, struct esense_reply * erp);
  46.  
  47. struct pa_msf {
  48.     u_int               min:8,
  49.                         sec:8,
  50.                         frame:8;
  51. };
  52. int
  53. do_playaudio_msf_47(int fd, struct pa_msf startmsf, struct pa_msf endmsf,
  54.             struct esense_reply * erp);
  55.  
  56. struct pb_status_reply {    /* playback status */
  57.     u_char              pbs_audio_status;
  58.     u_int               pbs_logical_block;    /* LBA format of abs time */
  59.     u_short             pbs_hour,    /* MSF format of abs time */
  60.                         pbs_min,
  61.                         pbs_sec,
  62.                         pbs_frame;
  63.     u_char              pbs_ch0_sel,    /* volume-of-play settings */
  64.                         pbs_ch0_vol;
  65.     u_char              pbs_ch1_sel,
  66.                         pbs_ch1_vol;
  67.     u_char              pbs_ch2_sel,
  68.                         pbs_ch2_vol;
  69.     u_char              pbs_ch3_sel,
  70.                         pbs_ch3_vol;
  71. };
  72.  
  73. /* values returned for pbs_audio_status: */
  74. #define PBS_ASTAT_PLAYING    0x00
  75. #define PBS_ASTAT_PAUSED    0x01
  76. #define PBS_ASTAT_MUTED        0x02    /* audio muting on */
  77. #define PBS_ASTAT_PLAYCOMPLETE    0x03    /* previous play command just
  78.                      * completed */
  79. #define PBS_ASTAT_PLAYABORTED     0x04    /* previous play command just aborted */
  80. #define PBS_ASTAT_NOREQ        0x05    /* audio play not requested (yet?) */
  81.  
  82. int
  83. do_playbackstatus_c4(int fd, struct pb_status_reply * pbstatus,
  84.              struct esense_reply * erp);
  85. int
  86. do_playbackvolume_c9(int fd, int leftVolume, int rightVolume,
  87.              struct esense_reply * erp);
  88.  
  89. /* instead of having a do_readsubchannel_42 routine, there are routines to
  90.  * return specific information from that (C10OP_READSUBCHANNEL = 42h) SCSI
  91.  * command.  These fill in a few fields, and mainly isolate calling programs
  92.  * from byte-endian issues in getting a "page of sub-q channel data".  Any
  93.  * program which wants a do_readsubchannel_42 routine should include the
  94.  * cd_cmdsint.h definitions directly.
  95.  */
  96. struct rsc_cur_pos_reply {
  97.     u_int               track:8,
  98.                         index:8;
  99.     u_int               rsc_control:8,
  100.                         rsc_audio_status:8;
  101.  /*
  102.   * "absolute time" is position on disk, "relative time" is position in the
  103.   * current track 
  104.   */
  105.     u_int               abs_logical_block;    /* LBA format of abs time */
  106.     u_int               rel_logical_block;    /* LBA format of rel time */
  107.     u_short             abs_hour,
  108.                         abs_min,
  109.                         abs_sec,
  110.                         abs_frame;
  111.     u_short             rel_hour,
  112.                         rel_min,
  113.                         rel_sec,
  114.                         rel_frame;
  115. };
  116.  
  117. /* values for rsc_audio_status:
  118.  * Note the CD-ROM that NeXT used to sell is all too eager to return
  119.  * "Paused" in situations where the drive isn't really pausing in the
  120.  * middle of a play request.  This makes audio_status much less useful.
  121.  */
  122. #define RSC_ASTAT_NOTSUPPORTED    0x00
  123. #define RSC_ASTAT_PLAYING    0x11
  124. #define RSC_ASTAT_PAUSED    0x12
  125. #define RSC_ASTAT_PLAYCOMPLETE    0x13    /* previous play command just
  126.                      * completed */
  127. #define RSC_ASTAT_PLAYABORTED     0x14    /* previous play command was just
  128.                      * aborted */
  129. #define RSC_ASTAT_NONE        0x15    /* no audio status (nothing is
  130.                      * happening) */
  131. int
  132. do_readcurrentposition_42(int fd, struct rsc_cur_pos_reply * curpos,
  133.               struct esense_reply * erp);
  134.  
  135. #define MEDIA_CATNUM_LENGTH 15
  136. struct rsc_media_catnum_reply {
  137.     u_char              catnum_isSet;
  138.     u_char              media_catnum[MEDIA_CATNUM_LENGTH];
  139. };
  140. int
  141. do_readmediacatnum_42(int fd, struct rsc_media_catnum_reply * catnum,
  142.               struct esense_reply * erp);
  143.  
  144. /* not done yet:
  145. int
  146. do_readtrackISRC_42(int fd, int track, struct rsc_track_isrc_reply *isrc,
  147.     struct esense_reply *erp);
  148. */
  149.  
  150. struct cd_volset_reply {    /* volume-of-play settings */
  151.     u_char              ch0_sel,
  152.                         ch0_vol;
  153.     u_char              ch1_sel,
  154.                         ch1_vol;
  155.     u_char              ch2_sel,
  156.                         ch2_vol;
  157.     u_char              ch3_sel,
  158.                         ch3_vol;
  159. };
  160.  
  161. int
  162. do_modesense_pc_E(int fd, struct cd_volset_reply * volset, struct esense_reply * erp);
  163. int
  164. do_modeselect_pc_E(int fd, int leftVolume, int rightVolume, struct esense_reply * erp);
  165.  
  166. #endif CD_COMMANDS
  167.